#1 open
Philipp Pirozhkov

implement templating behavior

Reported by Philipp Pirozhkov | November 28th, 2008 @ 10:48 AM | in basic templating

There are a lot of templating examples in README file, they should be moved to specs directory, with the following syntax: /behave/retem.re:


  context('flow control') do
    context('if statement') do
      template = renderer.parse('{if a}yes{end}')
      should('be resolved') do
        assert(template.render({~a: true}), 'yes')
        assert(template.render({~a: false}), '')

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Templating engine for Ryan/Reia
Retem provides a convenient syntax and a lot of features available out of the box:

* variables
* flow control
* filters
* i18n
* template nesting

== Usage
renderer = Retem.new()
template = renderer.parse("""Total {apples|count:~apples}
{for apple in apples} {apple.color apple.weight|kg} {end}""")
apples = [{~color: 'red', ~weight: 0.2}, {~color: 'yellow', ~weight: 0.15}]
renderer.render({~apples: apples})
=> Total 2 apples
.. red 0.2kg
.. yellow 0.15kg

There are a lot of templating examples in README on http://github.com/pirj/ryan/tree/master/src/retem

People watching this ticket

Tags

Pages